<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>后台管理模板</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="../../css/global.css" media="all">
		<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">
		<link rel="stylesheet" href="../../datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css">
		<style type="text/css">
			.d-to {
				float: left;
				margin: 10px 80px;
			}
			.d-title {
				font-size: 20px;
				margin-bottom: 10px
			}
			.d-item {
				font-size: 25px;
				color: #1AA094;
			}
			.layui-body {
			}
			.datalist {
				text-align: center;
				margin-left: 40px
			}
			.money {
				height: 300px;
			    width: 550px;
			    float: left;
			    margin-left: 35px;
			}
			.money img{
				border-radius: 0;
			    height: 166px;
			    width: 166px;
			    margin-top: 70px;
			    margin-left: 50px;
			    float: left;
			}
			#moneyIn {
				float: left;
				margin-top: 100px;
				margin-left: 20px;
			}
			.money_title {
				font-size: 24px;
			    color: rgb(152, 143, 131);
			    text-align: center;
			}
			.money_number{
				font-size: 50px;
			    margin-top: 20px;
			    color: rgb(175, 122, 57);
			    font-weight: 800;
			}
			#moneyOut {
				float: left;
				margin-top: 100px;
				margin-left: 20px;
			}

		</style>
	</head>
	<body>
		<div class="layui-layout layui-layout-admin" style="border-bottom: solid 5px #1aa094;">
			<!--头部导航-->
			<div class="layui-header header header-demo" ></div>
			<!--左侧导航-->
			<div class="layui-side layui-bg-black" id="admin-side">
			</div>
			<!--右侧具体内容-->
			<div class="layui-body" style="bottom: 0;border-left: solid 2px #1AA094;padding:20px" id="admin-body">
				<div class="datalist">
					<div class="d-to">

						<div class="d-title">今日完成订单</div>
						<div class="d-item todayOrder" ></div>
					</div>
					<div class="d-to">
						<div class="d-title">历史完成订单</div>
						<div class="d-item totalOrder"></div>
					</div>
					<div class="d-to">
						<div class="d-title">用户人数</div>
						<div class=" d-item totalUser"></div>
					</div>
					<div class="d-to">
						<div class="d-title">快递人数</div>
						<div class="d-item totalCourier"></div>
					</div>
				</div>
				<hr>
				<div class="money">
					<img src="../../images/yen_gold.png">
					<div id="moneyIn">
						<div class="money_title">今日流入金额</div>
						<div class="money_number"></div>
					</div>
				</div>
				<div class="money">
					<img src="../../images/yen_gold.png">
					<div id="moneyOut">
						<div class="money_title">今日流出金额</div>
						<div class="money_number"></div>
					</div>
				</div>
				<div id="main" style="width: 1200px;height:400px;"></div>

				<div id="main2" style="width: 1200px;height:400px;top: 300px;"></div>
			</div>
		</div>
		<!--底部导航-->
		<!-- <div class="layui-footer footer footer-demo" id="admin-footer"></div> -->
		<!--JS模块-->
		<script type="text/javascript" src="../../layui/layui.js"></script>
		<script src="../../js/jquery-1.12.3.min.js"></script>

		<script type="text/javascript" src="../../js/jquery.cookie.js"></script>
		<script type="text/javascript" src="http://echarts.baidu.com/dist/echarts.js"></script>
		<script type="text/javascript" src="../../js/count.js"></script>
		<script src="../../js/index.js"></script>
		<script type="text/javascript">
				$(document).ready(function() {
					var data1={
						"code": 200,
						"count": 77763

					}
					/*$.ajax({
						url: '/AdminController/todayOrderCount',
						type: 'GET',
						dataType: "json",
						data: {},
						success: function (data) {
            			}
					});*/
					$(".todayOrder").text(data1.count);
					
					var data2={
						"code": 200,
						"count": 83083

					}
					/*$.ajax({
						url: '/AdminController/totalOrder',
						type: 'GET',
						dataType: "json",
						data: {},
						success: function (data) {
            			}
					});*/
					$(".totalOrder").text(data2.count);

					var data3={
						"code": 200,
						"count": 55555

					}
					/*$.ajax({
						url: '/AdminController/totalUser',
						type: 'GET',
						dataType: "json",
						data: {},
						success: function (data) {
            			}
					});*/
					$(".totalUser").text(data3.count);

					var data4={
						"code": 200,
						"count": 6666

					}
					/*$.ajax({
						url: '/AdminController/totalCourier',
						type: 'GET',
						dataType: "json",
						data: {},
						success: function (data) {
            			}
					});*/
					$(".totalCourier").text(data4.count);

					var data11 = {//今日流入金额
						"code": 200,
						"count": 15424
					}
					$("#moneyIn .money_number").numberRock({
					    speed:14,//数字越大数字滚动速度越慢
					    count:data11.count//最终停留数字
					})

					var data12 = {//今日流出金额
						"code": 200,
						"count": 5424
					}
					$("#moneyOut .money_number").numberRock({
					    speed:14,//数字越大数字滚动速度越慢
					    count:data12.count//最终停留数字
					})








					var data_state={
						"code": 200,
						"orders": [{
							"state": "未接单",
							"count": 111
						},{
							"state": "已接单",
							"count": 222
						},{
							"state": "正在采购",
							"count": 333
						},{
							"state": "采购完成",
							"count": 444
						},{
							"state": "正在寄件",
							"count": 555
						},{
							"state": "派送中",
							"count": 666
						},{
							"state": "已关闭",
							"count": 777
						},{
							"state": "待确认收货",
							"count": 888
						},{
							"state": "待评价",
							"count": 999
						}]

					}
					/*$.ajax({
						url: '/AdminController/orderBystate',
						type: 'GET',
						dataType: "json",
						data: {},
						success: function (data) {
            			}
					});*/
					state(data_state);
					function state(data) {
						var statename = []
						var statenum = []
						$.each(data_state.orders, function(index, val) {
							statename.push(val.state);
							statenum.push(val.count);
						});
						var myChart = echarts.init(document.getElementById('main'));
						// 指定图表的配置项和数据
						var option = {
						title: {
						text: '状态-订单数'
						},
						tooltip: {},
						legend: {
						data:['订单数']
						},
						xAxis: {
						data: statename
						},
						yAxis: {},
						series: [{
						name: '订单数',
						type: 'bar',
						data: statenum
						}]
						};
						// 使用刚指定的配置项和数据显示图表。
						myChart.setOption(option);
						} */

						var data_usernum = {
							"code": 95789,
							"numberList": [
								16,
								50,
								84,
								123,
								234,
								456,
								678
							]

						}
						/*$.ajax({
						url: '/AdminController/usersNumberByDay/7',
						type: 'GET',
						dataType: "json",
						success: function (data) {
            			}
						});*/
						userup(data_usernum)
						function userup(data){
							var date = []
							var usernum = []
							$.each(data.numberList, function(index, val) {
								date.push((7-index)+"天前");
								usernum.push(val);
							});
							var myChart = echarts.init(document.getElementById('main2'));
							// 指定图表的配置项和数据
							var option = {
							title: {
							text: '日期-用户数'
							},
							tooltip: {},
							legend: {
							data:['用户数']
							},
							xAxis: {
							data: date
							},
							yAxis: {},
							series: [{
							name: '用户数',
							type: 'line',
							data: usernum
							}]
							};
							// 使用刚指定的配置项和数据显示图表。
							myChart.setOption(option);
						}

					adminCookie() 
					// C1=window.location.href.split("?")[1];
					// adminName=C1.split("=")[1].split("&&")[0]; 
					// headimg=C1.split("=")[2];
					// alert(C1);
					// alert(adminName);
					// alert(headimg)
				});
		</script>
	</body>
</html>